package formbeans;

import java.util.ArrayList;
import java.util.List;

import org.mybeans.form.FormBean;

public class MultipleChoiceQuestionForm extends FormBean {

	private String choice;
	
	public String getChoice() {
		return choice;
	}

	public void setChoice(String choice) {
		this.choice = choice;
	}
	
	public List<String> checkMultipleChoiceQuestionFormErrors(){
		List<String> errors = new ArrayList<String>();
		
		if (isEmpty(choice)) {
			errors.add("Please choose an answer");
			return errors;
		}
		
		return errors;
	}
	
	private boolean isEmpty(String str) {
		return (str == null || str.length() == 0);
	}
}